/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package roomarrange;

import com.sun.webui.jsf.model.Option;

/**
 *
 * @author ben
 */
public class mainHelper {

    public static Option[] getTimeQuantum(String app) {
        // </editor-fold>
        // Perform application initialization that must complete
        // *after* managed components are initialized
        // TODO - add your own initialization code here
        Option[] opt, opt2;
        opt = new Option[25];
        opt2 = new Option[48];
        int i = 0;
        int j = 0;
        String ls_tmp = "";
        if (app.equalsIgnoreCase("room")) {
            for (i = 0; i < 48; i++) {
                //改为7am-7pm
                if (i < 14 || i > 38) {
                    continue;
                }
                if (i < 20) {
                    if (i % 2 == 0) {
                        ls_tmp = "0" + i / 2 + ":00";
                    } else {
                        ls_tmp = "0" + i / 2 + ":30";
                    }
                } else {
                    if (i % 2 == 0) {
                        ls_tmp = i / 2 + ":00";
                    } else {
                        ls_tmp = i / 2 + ":30";
                    }
                }
                opt[j] = new Option(ls_tmp, ls_tmp);
                j++;
                //cls
                ls_tmp = "";
            }

            return opt;
        } else {
            for (i = 0; i < 48; i++) {
                if (i < 20) {
                    if (i % 2 == 0) {
                        ls_tmp = "0" + i / 2 + ":00";
                    } else {
                        ls_tmp = "0" + i / 2 + ":30";
                    }
                } else {
                    if (i % 2 == 0) {
                        ls_tmp = i / 2 + ":00";
                    } else {
                        ls_tmp = i / 2 + ":30";
                    }
                }
                opt2[j] = new Option(ls_tmp, ls_tmp);
                j++;
                //cls
                ls_tmp = "";
            }
            return opt2;
        }
    }
}
